/*
 * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cyj.dream.security.exception;

import com.cyj.dream.security.component.SosAuth2ExceptionSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @Description: 自定义OAuth2Exception
 * @BelongsProject: DreamChardonnay
 * @BelongsPackage: com.cyj.dream.security.exception
 * @Author: ChenYongJia
 * @CreateTime: 2021-10-19 13:30
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@JsonSerialize(using = SosAuth2ExceptionSerializer.class)
public class SelfAuth2Exception extends OAuth2Exception {

    @Getter
    private String errorCode;

    @Getter
    private int code;

    public SelfAuth2Exception(String msg) {
        super(msg);
    }

    public SelfAuth2Exception(String msg, String errorCode) {
        super(msg);
        this.errorCode = errorCode;
    }

    public SelfAuth2Exception(String msg, String errorCode, int code) {
        super(msg);
        this.errorCode = errorCode;
        this.code = code;
    }

}
